Jes.Aclduty ={
	init : function(){
		if(!Jes.userSess()) return;
		Jes.cBtn('../../jesacl/html/welcome.html');
		Jes("search").onclick=function(){Jes.Aclduty.query();}
		Jes("add").onclick=function(){Jes.Aclduty.open('op');}
		Jes("del").onclick=function(){Jes.Aclduty.del('del');}
		initTabs('tabView_1',Array('职务查询'),0,"100%",90,Array(false));
		this.query();
	}
	,query : function(){
		Jes.page("aclduty_query_sql@acl",{pageSize:10});
	}
	,del : function(){
		var ids = Jes.val("id");
		if(ids == ""){alert("至少选择一项!");return;}
		if(!confirm("你确定删除职务吗？")) return;
		Jes.sql({ids:ids,sql:"aclduty_delete_hql@bs"});
	}
	,open : function(type,id){
		var args= arguments;
		switch(type){
			case "op":
					_newTab(id?'职务编辑':'职务新增',"acldutyop.html".J({id:id}));
				break;
		}
	}
}

//op
Jes.AcldutyOp = {
	init : function(){
		if(!Jes.userSess()) return;
		var id = Jes.request("id");
		Jes("add").onclick=function(){Jes.AcldutyOp.save();}//save
		Jes.cBtn();
		if(id){
			//Jes.html('op_title','职务编辑');
			Jes.queryO('Aclduty',{param:{id:id}});
		}
	}
	,save : function(){
		Jes.save("Aclduty",{},"aclduty_query_sql@acl");
	}
}

Jes.AclRolefmenu = {
	init : function(){
		if(!Jes.userSess()) return;
		Jes.Select.role('roleid');
		var id = Jes.request('id');
		Jes('add').onclick=function(){Jes.AclRolefmenu.save();}//save
		Jes.cBtn();
		this.treeQuery();
	}
	,treeQuery : function(){
		Jes.action('getFmenuTree@App',{all:'1',type:'checkbox',role:'0',upD:'1',pro:'title="栏目" rule="group"'},function(data){
			Jes.html('fmenu_tree',data);
			treeObj = new JSDragDropTree();
			//treeObj.fn = 'Jes.Fmenu.edit';
			//treeObj.setImageFolder('../../components/drag-drop-folder-tree/images/');//设置图片路径
			treeObj.setTreeId('dhtml_tree');
			treeObj.setMaximumDepth(10);
			//treeObj.setAddAllowed(true);
			//treeObj.setEditAllowed(true);
			//treeObj.setDeleteAllowed(true);
			//treeObj.setUserFunctionAfterDropDragableNodes(function(id,pId){Jes.Fmenu.moveNode(id,pId)});
			treeObj.setMessageMaximumDepthReached('超过最多级别'); // If you want to show a message when maximum depth is reached, i.e. on drop.
			treeObj.initTree();
			//treeObj.expandAll();
			treeObj.expand(true);//see
		});
	}
	,selRole : function(){
		Jes('tree.fall').checked=false;
		Jes.query('aclrolefmenu_query_sql@acl',null,function(da){
			var fmEls = Jes.name('tree.fmenuid');
			//判断一下是否全选
			if(da.length==fmEls.length){
				Jes('tree.fall').checked=true;
				Jes.each(fmEls,function(i){
					fmEls[i].checked = true;
				});
			}else{
				Jes.each(fmEls,function(i){
					fmEls[i].checked=false;
					Jes.each(da,function(j){
						if(fmEls[i].value==da[j]['fmenuid']){
							fmEls[i].checked=true;
							return false;
						}
					});
				});
			}
		});
	}
	,save : function(){
		Jes.save('TJesRolefmenu');
	}
}

Jes.AclRoleDic = {
	init : function(){
		if(!Jes.userSess()) return;
		Jes.Select.role('roleid');
		var id = Jes.request("id");
		Jes("add").onclick=function(){Jes.AclRoleDic.save();}//save
		Jes.cBtn();
		Jes.query('acldic_query_sql@sel',{param:{keytype:'ASK'}},function(da){
			var html =[];
			Jes.each(da,function(i){
				html.push('<input type="checkbox" id="type" name="type" class="checkbox" title="类型" rule="group" value="'+this.id+'"/>'+this.name);
			});
			Jes.html('type',html);
		});
	}
	,selRole : function(){
		Jes.query('aclroledic_query_sql@acl',null,function(da){
			var els = Jes.name('type');
			Jes.each(els,function(i){
				els[i].checked=false;
				Jes.each(da,function(j){
					if(els[i].value==da[j]['diccode']){
						els[i].checked=true;
						return false;
					}
				});
			});
		});
	}
	,save : function(){
		Jes.save('TJesRoledic');
	}
}